﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Transactions;
using System.Data.Objects;




using System.Data.EntityClient;

namespace StudentEFConsoleApp
{
    class Program
    {

        static void Main(string[] args)
        {
            ////Using entities which is derived from EntityObject. (Default generated entities & context)
            EntityObjectDemo.AddDemo();
            EntityObjectDemo.AddOneToOneDemo();
            EntityObjectDemo.AddOneToManyDemo();
            EntityObjectDemo.AddManyToManyDemo();

            EntityObjectDemo.UpdateDemo();
            EntityObjectDemo.UpdateOneToOneDemo();
            EntityObjectDemo.UpdateOneToManyDemo();
            EntityObjectDemo.UpdateManyToManyDemo();

            EntityObjectDemo.DeleteDemo();
            EntityObjectDemo.DeleteOneToOneDemo();
            EntityObjectDemo.DeleteOneToManyDemo();
            EntityObjectDemo.DeleteManyToManyDemo();
            Console.WriteLine(" ");

            ////Using POCOProxy entities in Connected scenario
            POCOProxyInConnectedScenario.AddDemo();
            POCOProxyInConnectedScenario.AddOneToOneDemo();
            POCOProxyInConnectedScenario.AddOneToManyDemo();
            POCOProxyInConnectedScenario.AddManyToManyDemo();

            POCOProxyInConnectedScenario.UpdateDemo();
            POCOProxyInConnectedScenario.UpdateOneToOneDemo();
            POCOProxyInConnectedScenario.UpdateOneToManyDemo();
            POCOProxyInConnectedScenario.UpdateManyToManyDemo();

            POCOProxyInConnectedScenario.DeleteDemo();
            POCOProxyInConnectedScenario.DeleteOneToOneDemo();
            POCOProxyInConnectedScenario.DeleteOneToManyDemo();
            POCOProxyInConnectedScenario.DeleteManyToManyDemo();
            Console.WriteLine(" ");

            ////Using POCOProxy entities in Disconnected scenario
            POCOProxyInDisconnectedScenario.AddDemo();
            POCOProxyInDisconnectedScenario.AddOneToOneDemo();
            POCOProxyInDisconnectedScenario.AddOneToManyDemo();
            POCOProxyInDisconnectedScenario.AddManyToManyDemo();

            POCOProxyInDisconnectedScenario.UpdateDemo();
            POCOProxyInDisconnectedScenario.UpdateOneToOneDemo();
            POCOProxyInDisconnectedScenario.UpdateOneToManyDemo();
            POCOProxyInDisconnectedScenario.UpdateManyToManyDemo();

            POCOProxyInDisconnectedScenario.DeleteDemo();
            POCOProxyInDisconnectedScenario.DeleteOneToOneDemo();
            POCOProxyInDisconnectedScenario.DeleteOneToManyDemo();
            POCOProxyInDisconnectedScenario.DeleteManyToManyDemo();
            Console.WriteLine(" ");

            //Using POCO entities (non-proxy) in Disconnected scenario
            POCOInDisconnectedScenario.AddDemo();
            POCOInDisconnectedScenario.AddOneToOneDemo();
            POCOInDisconnectedScenario.AddOneToManyDemo();
            POCOInDisconnectedScenario.AddManyToManyDemo();

            POCOInDisconnectedScenario.UpdateDemo();
            POCOInDisconnectedScenario.UpdateOneToOneDemo();
            POCOInDisconnectedScenario.UpdateOneToManyDemo();
            POCOInDisconnectedScenario.UpdateManyToManyDemo();

            POCOInDisconnectedScenario.DeleteDemo();
            POCOInDisconnectedScenario.DeleteOneToOneDemo();
            POCOInDisconnectedScenario.DeleteOneToManyDemo();
            POCOInDisconnectedScenario.DeleteManyToManyDemo();

            Console.WriteLine(" ");

            Console.WriteLine("Accessing WCF service from STE");

            //Using STE (Self-tracking entities) in Disconnected scenario
            STEInDisconnectedScenario.AddDemo();
            STEInDisconnectedScenario.UpdateDemo();
            STEInDisconnectedScenario.DeleteDemo();

            Console.WriteLine(" ");

            Console.WriteLine("Demo Complete Successfully");
            
          //  CallToStoredProcedure();
            Console.ReadKey();
        }

      

      

        static void CallToStoredProcedure()
        {
            //SchoolDBEntities ent = new SchoolDBEntities();
            
            //var stud = (from s in ent.Teachers
            //            .Include("Standard")
            //            .Include("Students")
            //            where s.TeacherId == 1
            //            select s).ToList();

            //var res = ent.GetCoursesByStudentId(3).ToList<GetCoursesByStudentId_Result>();
            //string sd = "";
        
        }

    }
}
